﻿using System;
using System.Linq;
using System.Text;

namespace School
{
    public class Student
    {
        private string studentName;
        private int studentUniqueNumber;

        public Student()
        {
        }

        public Student(string name, int number)
        {
            this.studentName = name;
            this.studentUniqueNumber = number;
        }

        public string Name
        {
            get
            {
                return this.studentName;
            }
        
            set
            {
                if (value != null && value != String.Empty)
                {
                    this.studentName = value;
                }
                else
                {
                    throw new ArgumentNullException("The name of the student can not be null or empty string!");
                }
                
            }
        }
        
        public int UniqueNumber
        {
            get
            {
                return this.studentUniqueNumber;
            }
            set
            {
                if (value >= 10000 && value <= 99999)
                {
                    this.studentUniqueNumber = value;
                }
                else
                {
                    throw new ArgumentOutOfRangeException("The unique number of " + this.studentName + " must be between 10000 and 99999!");
                }
            }
        }

        public override string ToString()
        {
            StringBuilder studentToString = new StringBuilder();
            studentToString.Append("Name: " + this.studentName + ", Unique number: " + this.studentUniqueNumber);
            return studentToString.ToString();
        }

    }
}
